package cn.com.chengq.filesshared;

import cn.com.chengq.filesshared.servlet.MyServlet;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;

import javax.servlet.Servlet;

@SpringBootApplication
// @ServletComponentScan("cn.com.chengq.filesshared.servlet")
public class App extends SpringBootServletInitializer {

    @Value("${name}")
    private String name;


    @Value("${my.secret}")
    private String mySecret;

    @Value("${my.number}")
    private String myNumber;

    @Value("${my.big_number}")
    private long bigNumber;

    @Value("${my.uuid}")
    private String uuid;

    @Value("${my.number_less_than_ten}")
    private int numberLessThanTen;

    @Value("${my.number_in_range}")
    private int numberInRange;

    @Bean
    public ExitCodeGenerator exitCodeGenerator() {
        return () -> 0;
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(App.class);
    }


    public static void main(String[] args) {
//        SpringApplication app = new SpringApplication(App.class);
//        app.run(args);


//        System.exit(SpringApplication.exit(
//                SpringApplication.run(App.class, args)
//        ));

        SpringApplication.run(App.class, args);
    }
}
